Purpose
The length (array) task is used to return the number of elements in a given array. The return value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. By unsigned, the value represents only non-negative integers.
Potential Use Case
Every failed login attempt on your device stores the username and timestamp in an array. Your company's password attempt policy stipulates a maximum of 3 failed attempts within a specific timeframe. The length (array) task will provide the number of login attempts for subsequent workflow processing.
Properties
Input and output properties are shown below.
Incoming | Type | Description |
---|---|---|
arr |
array (required) | The array to get the length of. |
Outgoing | Type | Description |
---|---|---|
length |
number | Expressed as a numerical value, this is the number of items in the array. |
Examples
In the IAP examples shown below:
The Reference task and Reference variable set for the length (array) task is
job
andarr
, respectively. As an option, you can toggle the Run Window slider to set the task to run on a schedule.The array variables are set prior to running the workflow.
Once you run the workflow, the incoming variables that were set are displayed under the Incoming tab in Task History, which is accessed from Job Manager.
This output example returns the length of the array.
Additional Information
For general information on how to use tasks in Automation Builder, refer to the Tasks section in the Automation Studio documentation.